package io.renren.service.impl;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.dao.BalanceDetailDao;
import io.renren.entity.BalanceDetailEntity;
import io.renren.service.BalanceDetailService;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

@Service("balanceDetailService")
public class BalanceDetailServiceImpl extends ServiceImpl<BalanceDetailDao, BalanceDetailEntity> implements BalanceDetailService {

	@Override
	public PageUtils queryPage(Map<String, Object> params) {
		Integer category = (Integer) params.get("category");
		Long id = (Long) params.get("id");
		Page<BalanceDetailEntity> page = this.selectPage(new Query<BalanceDetailEntity>(params).getPage(), new EntityWrapper<BalanceDetailEntity>().eq(id != null, "member_id", id)
				.eq(category != null, "category", category).orderBy("create_time", false));

		return new PageUtils(page);
	}

}
